//
//  BaseNavigationController.m
//  Project_2_weibo
//
//  Created by 林林 on 16/6/16.
//  Copyright © 2016年 lhn. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self navigationBarBackgroundImage];
    
    //去掉黑线
    self.navigationBar.shadowImage = [[UIImage alloc] init];
    //设置标题字体和颜色
    NSDictionary *atrDic = @{NSFontAttributeName : [UIFont systemFontOfSize:20],
                             NSForegroundColorAttributeName : [UIColor whiteColor]};
    self.navigationBar.titleTextAttributes = atrDic;
    
    //设置导航栏不透明
    self.navigationBar.translucent = NO;
    
    //添加通知,监听主题改变
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(navigationBarBackgroundImage) name:kThemeChangedNotificationName object:nil];

}

- (void)navigationBarBackgroundImage {
    
    //判断当前系统版本
    CGFloat deviceVersion = [[UIDevice currentDevice].systemVersion floatValue];
    UIImage *image = nil;
    if (deviceVersion >= 7.0) {
        image = [[ThemeManager sharedManager] themeImageWithImageName:@"mask_titlebar64"];
    }else {
        image = [[ThemeManager sharedManager] themeImageWithImageName:@"mask_titlebar"];
    }
    //设置背景图片
    [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
